<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Stimulus360.Controllers.Projects.ProjectsSearchViewModel>" %>
<%@ Import Namespace="Stimulus360.Models.Data" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<%
    SearchCriteria  criteria =(SearchCriteria) Enum.Parse(typeof (SearchCriteria), Model.SearchCriteria);
    var heading = criteria.Description();
    if (criteria.ToString().Equals("Volunteers"))
    {
        if (bool.Parse(Model.SearchString) == true)
        {
            heading = heading + "Required";
        }
        else
        {
            heading = heading + "Not-Required";
        }
    }
    else
    {
        heading = heading + Model.SearchString;
    }
     %>
<div class="main">
    	<div class="contetTittle">
			<div class="floatLeft">
				 <a href="javascript:void(0);" class="headerLabel"><span><%=heading%></span></a>
			</div>
		  
			</div> 
			 <div id="projListContainer">
            <%Html.RenderPartial("ProjectsList",Model.Projects); %>
        </div>
            <div class="pagerbg">
            <div id="pagerProjList" class="pager"></div>
            </div>
	  </div>
	  
	  <!-- Right Col Start -->
    <div class="rightCol">
        <%Html.RenderPartial("ProjectSearch"); %>
        
        <%Html.RenderPartial("ProjectsTagCloud", Model.Categories); %>
    
        <%Html.RenderPartial("ProjectRSSTagCloud"); %>
    </div>
<!-- Right Col Start -->
   <script type="text/javascript" language="javascript">
       $(document).ready(function() {
           var criteria = "<%=Model.SearchCriteria %>";
           var searchString = "<%=Model.SearchString %>";
           if (criteria == "Search") {
               $("#query").val("<%=Model.SearchString %>");
           }
           else {
               if (criteria == "Volunteers") {                   
                   if( searchString == 'true') {
                       $("#query").val("<%=Model.SearchCriteria %>" + ": " + "Required");
                   }
                   else {
                       $("#query").val("<%=Model.SearchCriteria %>" + ": " + "Not-Required");
                   }
               }
               else {
                   $("#query").val("<%=Model.SearchCriteria %>" + ": " + "<%=Model.SearchString %>");
               }
           }
           var totalPages_Idea = "<%=Model.Projects.TotalPages %>";
           if (totalPages_Idea == 1) {
               $(".pagerbg").hide();
           }
           var totalCount = "<%=Model.Projects.TotalCount %>";
           if (totalCount == 0) {
               $(".pagerbg").hide();
           }
           
           var currentPage = "<%=Model.Projects.PageIndex%>";
           $("#pagerProjList").pager({ pagenumber: currentPage, pagecount: totalPages_Idea, buttonClickCallback: PageClick_ProjList });
       });
       PageClick_ProjList = function(pageclickednuber) {
           var pageIndex = pageclickednuber;
           var criteria = "<%=Model.SearchCriteria %>";
           var searchString = "<%=Model.SearchString%>";
           window.location = "/Projects/Search/" + criteria + "/" + searchString;
       } 


   </script>

</asp:Content>


